<?php

Class Create_captcha
{	
	public function _captcha()
	{
		$CI =& get_instance();
		$CI->load->helper('captcha');
		
		$system_counted_hash = bin2hex(mcrypt_create_iv(32, MCRYPT_DEV_URANDOM));
		$vals = array(
			'word'	 => substr(sha1(rand(1,100).$system_counted_hash),3,rand(3,5)),
			'img_path'	 => './captcha/',
			'img_url'	 => base_url().'auth/captcha',
			'font_path'	 => './assets/fonts/4.ttf',
			'img_width'	 => '150',
			'img_height' => 35,
			'expiration' => 7200
			);
		
		$cap = create_captcha($vals);
		$image['word'] = $cap['word'];
		$image['image'] ='<image src="'.base_url().'captcha/'.$cap['time'].'.jpg"/>';
		$image['link'] = './captcha/'.$cap['time'].'.jpg';
		return (object)$image;
	}
}